package com.material.vtool.service.impl;

import com.material.vtool.entity.BTeamMaterialTypeEntity;
import com.material.vtool.entity.combinedEntity.TeamMaterialLabelEntity;
import com.material.vtool.mapper.TeamMaterialTypeMapper;
import com.material.vtool.service.TeamMaterialTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeamMaterialTypeServiceImpl implements TeamMaterialTypeService {
    @Autowired
    private TeamMaterialTypeMapper teamMaterialTypeMapper;

    @Override
    public List<TeamMaterialLabelEntity> getTeamLableList(Integer teamId) {
        return teamMaterialTypeMapper.getTeamLableList(teamId);
    }

    @Override
    public boolean isExist(Integer labelTypeId, Integer teamId) {
        int affectCount = teamMaterialTypeMapper.getTeamLableById(labelTypeId, teamId);
        return affectCount > 0;
    }

    @Override
    public int save(BTeamMaterialTypeEntity bTeamMaterialTypeEntity) {
        return teamMaterialTypeMapper.insertEntity(bTeamMaterialTypeEntity);
    }
}
